package com.spyx.home.controller;

import com.spyx.auth.AuthContextHolder;
import com.spyx.home.service.HomeService;
import com.spyx.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api/home")
@Api(tags = "小程序端首页展示")
public class HomeApiController {
    @Autowired
    private HomeService homeService;

    @GetMapping("index")
    @ApiOperation("首页查询")
    public  Result home(){
        Long userId = AuthContextHolder.getUserId();
        Map map=homeService.getHomeData(userId);
        return Result.ok(map);
    }
}
